package com.kemai.designmode.Facaed

import com.kemai.designmode.decorator.CheckedBagDecorator
import com.kemai.designmode.decorator.ReinforceBagDecorator
import com.kemai.designmode.decorator.SpeedDecorator
import com.kemai.designmode.entry.Bag
import com.kemai.designmode.entry.Fruit
import com.kemai.designmode.factory.abstract.AbstractFactory
import com.kemai.designmode.factory.abstract.AppleAbstractFactory

/**

 *@description:打包服务
 * @author: zhaoshanshan
 * @date: 2022/10/3 10:41 下午

 */
class PackService {
    var factory: AbstractFactory = AppleAbstractFactory()
    var fruit: Fruit? = null
    var bag: Bag? = null
    fun doPack(){
        fruit = factory.getFruit()
        fruit?.draw()
        bag = factory?.getBag()
        bag = CheckedBagDecorator(bag!!)
        bag = ReinforceBagDecorator(bag!!)
        bag = SpeedDecorator(bag!!)
        bag?.pack()

    }
}